<template>
  <div class=''>
    <h1>欢迎登陆,现在时间是:{{date}}</h1>
  </div>
</template>

<script>
export default {
  name: 'date',
  data () {
    return {
      date: new Date().toLocaleTimeString(),
      timer: null
    }
  },
  mounted () { },
  methods: {
    updateTime () {
      this.date = new Date().toLocaleTimeString()
    }
  },
  created () {
    this.timer = setInterval(this.updateTime, 1000)
  },
  beforeDestory () {
    // 释放
    this.timer.claey()
  },
  components: {}
}
</script>

<style lang='scss'>
</style>
